#include "htil.hpp"



class Logging
{
public:
    Logging(const std::string& log_file)
    {
        log = std::ofstream(log_file.c_str());
        if(!log.is_open())
        {
            std::cerr << "日志文件不存在" << std::endl;
            exit(2);
        }
    }
    ~Logging()
    {
        if(log.is_open())
            log.close();
    }
    void WriteLogToDoc(const std::string& level, const std::string& what, const std::string& time)
    {
        if(log.is_open())
        {
            log << "[" << level << "] " << what << " " << "(" << time << ")" << std::endl;
        }
    }

private:
    std::ofstream log;
};